import request from '../utils/request';


export default {
    findAll() {
        return request({
            url: '/yearTarget/getAll',
            method: 'get'
        });
    },
    insertTargetYearTask(form) {
        var param = {
            code: form.codeId,
            name: form.name
        }
        return request({
            url: '/yearTarget/add',
            method: 'post',
            data: param
        });
    },
    deleteTargetYearTask(id) {
        return request({
            url: '/yearTarget/delete',
            method: 'delete',
            params: {
                id
            }
        });
    },
    // 根据id获取信息
    getTargetYearTask(id) {
        return request({
            url: '/yearTarget/get',
            method: 'get',
            params: {
                id
            }
        });
    },
    // 根据id修改信息
    editTargetYearTask(id, code, name) {
        var param = {
            code: code,
            name: name
        }
        return request({
            url: `/yearTarget/update/${id}`,
            method: 'post',
            data: param
        });
    },
    // 分页查询
    getPageTargetYearTask(pageNum,pageSize){
        var param ={
            pageNum: pageNum,
            pageSize: pageSize
        }
        return request({
            url: `/yearTarget/selectPage`,
            method: 'post',
            data: param
        });
    },
    // 组合查询
    getCombineSearch(pageNum,pageSize,code,name){
        var data1 ={
            pageNum: pageNum,
            pageSize: pageSize
        }
        return request({
            url: `/yearTarget/findByCondition`,
            method: 'post',
            data: data1,
            params: {
                code,
                name
            }
        });
    }
}
